package com.alibaba.citrus.ots.sales.plan.functions.salesplan.audit;

import com.alibaba.citrus.ots.common.util.SpringContextUtil;
import com.alibaba.citrus.ots.sales.plan.repository.SalesPlanAuditTaskRepository;
import com.alibaba.citrus.ots.sales.plan.sdo.SalesPlanAuditTaskSDO;
import lombok.Getter;
import lombok.Setter;

/**
 * @author zls
 * @description:
 * @date 2021-09-23 19:02
 */
public class SalesPlanAuditTaskEntity {
    @Getter
    @Setter
    private SalesPlanAuditTaskSDO salesPlanAuditTaskSDO;

    private static SalesPlanAuditTaskRepository salesPlanAuditTaskRepository;
    static {
        salesPlanAuditTaskRepository = SpringContextUtil.getBean(SalesPlanAuditTaskRepository.class);
    }

    public static SalesPlanAuditTaskEntity of(SalesPlanAuditTaskSDO sdo) {
        SalesPlanAuditTaskEntity entity = new SalesPlanAuditTaskEntity();
        entity.setSalesPlanAuditTaskSDO(sdo);
        return entity;
    }

    public String save() {
        return salesPlanAuditTaskRepository.save(this.salesPlanAuditTaskSDO);
    }

    public Boolean edit(){
        return salesPlanAuditTaskRepository.edit(this.salesPlanAuditTaskSDO);
    }

    public Boolean updateByNonId(){
        return salesPlanAuditTaskRepository.updateSalesPlanAuditTaskByNonId(this.salesPlanAuditTaskSDO);
    }
}
